<template>
	<view>
		<cu-custom bgColor="bg-gradual-pink" :isBack="true"><block slot="backText">返回</block>
			<block slot="content">赛事须知</block>
		</cu-custom>
		<view>
			{{needknow}}
		</view>
	</view>
</template>

<script>
	export default {
		onLoad(option) {
			this.mid=option.mid;
			console.log(this.mid);
			uni.request({
				url:"https://www.52tennis.cn/Match/GetMatchNeedKnow",
				
				data: {
					matchid:option.mid
				},
				success:(data)=> {
					console.log(data);
					if(data.data.result==1){
						this.needknow=data.data.returnjson;
						
						let extName = this.needknow.substring(this.needknow.lastIndexOf(".")).toLowerCase();
						
						let AllUpExt = ".doc|.docx|.xls|.xlsx|.pdf|";
						if(AllUpExt.indexOf(extName + "|") == "-1"){
							
						}else{
							this.needknow="";
							uni.downloadFile({
							  url: 'https://www.52tennis.cn/upload/zb.xlsx',
							  success: function (res) {
									console.log("xiazai");
									var filePath = res.tempFilePath;
									uni.openDocument({
										filePath: filePath,
										success: function (res) {
											console.log('打开文档成功');
										}
									});
								}
							});
						}
						
					}else{
						uni.showToast({
							title: '数据错误',
							icon: 'fail',
							mask: true,
							duration: 3000
						})
					}
				},
			})
		},
		data() {
			return {
				mid:0,
				needknow:""
			}
		},
		methods: {
			
		}
	}
</script>

<style>

</style>
